<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="utf-8" />
        <title>Carousel - ESUI Demo</title>
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="../dep/esui/3.2.0-beta.2/demo/assets/google-code-prettify/prettify.css"/>
        <link rel="stylesheet" href="assets/themes/standard.css" />
        <!--[if lt IE 9]>
        <link rel="stylesheet" href="../dep/esui/3.2.0-beta.2/demo/assets/ie8.css"/>
        <![endif]-->
    </head>
<body>
    <div class="header">
        <h1 id="branding">ESUI Carousel</h1>
    </div>
    <div class="ui-g main-container">
        <div id="side-bar" class="ui-u-1-5">
            <ul id="navigator" class="ui-nav">
            </ul>
        </div>
        <div id="main" class="ui-u-4-5">
            <h2>Carousel显示</h2>
            <p>可以切换的Carousel。</p>
            <div class="example" id="container">
                <div data-ui="type:Carousel;id:car;" style="margin-bottom:30px;"></div>
            </div>
            <script type="text/sample" data-refid="main-js">
            </script>
        </div>
    </div>
    <script src="../dep/esui/3.2.0-beta.2/demo/assets/loader/esl.js"></script>
    <script src="config.js"></script>
    <script src="../dep/esui/3.2.0-beta.2/demo/demo.js"></script>
    <script src="../dep/esui/3.2.0-beta.2/demo/assets/google-code-prettify/prettify.js"></script>
    <script id="main-js">
    require(
        [
            'esui',
            'ub-ria-ui/Carousel',
            'jquery',
            'demo',
            'esui/Tab'
        ],
        function (ui, Carousel, $) {
            var item = {
                // 模板id
                id: 1,
                // 模板缩略图
                url: 'http://pic1.5442.com/2013/0808/07/01.jpg'
            };
            var datasource = [];
            for (var i = 1; i < 21; i++) {
                var newItem = $.extend(true, {}, item);
                newItem.id = i;
                datasource.push(newItem);
            }
            var model = {
                datasource: datasource,
                disabled: false,
                itemWidth: 150,
                itemHeight: 93,
                pageSize: 5
            };
            window.ui = ui;
            ui.init();
            var car1 = ui.get('car');
            car1.setProperties({
                datasource: datasource,
                value: 5,
                disabled: true
            });

            var car2 = new Carousel(model);
            car2.on('change', function (e) {
                // console.log(e.target.value, e.target.selectedItem, e.target.selectedIndex);
            });
            car2.appendTo(document.getElementById('container'));
        }
    );
    </script>
    <script src="sitemap.js"></script>
</body>
</html>
